
Ext.define('MyDesktop.UserManager',{
	extend:'Ext.ux.desktop.Module',
	id:'user-manager-win',
	init:function(){
		this.launcher = {
			text:'用户管理',
			iconCls:'accordion'
		}
	},
	
	createWindow:function(){
		var desktop = this.app.getDesktop();
        var win = desktop.getWindow('user-manager-win');
        if(!win)
        {
        	win = desktop.createWindow({
        		id:'user-manager-win',
        		title:'用户管理',
        		width:800,
        		height:500,
        		layout: 'fit',
        		
        		//window item start
                items: [
                    {
                        border: false,
                        xtype: 'grid',
                         
                        //dockedItems start
                         dockedItems:[
                                      {    
                                    	 dock:'bottom',    
                                    	 xtype:'pagingtoolbar',
                                    	 store:Ext.create('WT.store.usermanager.UserListStore'),
                                    	 displayInfo:true,    
                                    	 displayMsg:'显示{0}-{1}条，共计{2}条',    
                                    	 emptyMsg:'没有数据'    
                                     },
                                     
                                     {
                                         xtype: 'toolbar',
                                         items: [{
                                        	 text:'创建',
                                             tooltip:'创建',
                                             iconCls:'add',
                                             xtype:'button',
                                             id:'user-manager-create-user'
                                         },'-',{
                                        	 text:'删除',
                                             tooltip:'删除',
                                             iconCls:'remove'
                                         },'->',{
                                        	 xtype:'textfield',
                                        	 fieldLabel:'用户名',
                                        	 labelWidth:40
                                         },
                                         {
                                        	 xtype:'button',
                                        	 text:'查询'
                                         }]
                                }],
                         //dockedItems end
                                 
                        selModel: new Ext.selection.CheckboxModel,
                     
                        //columns start
                        columns: [
                            new Ext.grid.RowNumberer(),
                            {
                                text: "用户名",
                                flex:1,
                                sortable: true,
                                dataIndex: 'userName'
                            },
                            {
                                text: "所属角色",
                                width: 80,
                                sortable: true,
                                //renderer: Ext.util.Format.usMoney,
                                dataIndex: 'role'
                            },
                            {
                                text: "描述",
                                width: 150,
                                sortable: true,
                                dataIndex: 'description'
                            },
                            {
                                text: "使用状态",
                                width: 80,
                                sortable: true,
                                dataIndex: 'status'
                            },
                            {
                            	text:'编辑',
                                width:70,
                                renderer:function(value, metaData, record){   
                            	   return "<img src='../extjs/shared/icons/fam/edit.png' />"; 
                            	   }  
                            },
                            {
                            	text:'重置',
                                width:70,
                                renderer:function(value, metaData, record){   
                         	     return "<img src='../extjs/shared/icons/fam/rest.png' />"; 
                         	    } 
                            },
                            {
                            	text:'启动',
                            	width:70,
                            	renderer:function(value, metaData, record){   
                        	     return "<img src='../extjs/shared/icons/fam/stopplay.png' />"; 
                        	    } 
                            }],
                            
                          //columns end
                          store:Ext.create('WT.store.usermanager.UserListStore')
                    }
                ]
              
              //window item end
        		
        	});
        }
        return win;
	}
});
